Ext.define('jwawa.erp.framework.JwawaCombobox', {
    extend: 'Ext.form.field.ComboBox',
    alias: 'widget.jwawaCombobox',
    initComponent: function() {
        var me = this;
        me.callParent(arguments);

        me.addListener('select', function(combo){
            Ext.defer(function(){combo.focus()}, DEFAULT_FOCUS_DEFER_TIME);
        });
        me.addListener('keydown', function(combo, e, eOpts){
            if(e['button'] == 26){
                if(combo.isExpanded){
                    combo.collapse();
                    Ext.defer(function(){combo.focus()}, DEFAULT_FOCUS_DEFER_TIME);
                }
            }
        });

        me.addListener('collapse', function(combo, e){
           if(Ext.isEmpty(combo.getDisplayValue())){
               combo.setValue(null);
           }
        });
    },

    getValue: function(){
        var me = this;
        return me.callParent(arguments);
    }
});